There is a technique for (i) detecting skew of a document image on the basis of image data obtained by reading a document with the use of an image input apparatus such as a scanner and (ii) correcting the skew of the document image so as to display or print the document image which is not skewed. The term “document image” used herein refers to an image obtained by reading a document, and the term “image area” refers to an area within a document where an image (content) is present.
For example, Patent Literature 1 discloses that a document is read by reading a maximum readable area regardless of a document size so that image data of a maximum size is obtained, and an area of a sheet size of the document (same as the document size) inputted by a user is found as a crop box. The crop box is a rectangular area, and is, for example, expressed by a combination of y-coordinates of an upper end and a lower end and x-coordinates of an right end and a left end (the coordinates are determined on the basis of an origin of the image of the maximum size).
Specifically, an area where an image density is equal to or larger than a predetermined threshold value in the image data of the maximum size is detected as an area where an image is present, and an area which encompasses the area where the image is present and which has a shape and a size corresponding to the sheet size of the document is found as a crop box. The area where the image is present is generally smaller than the sheet size. Accordingly, a position of the crop box is, for example, determined so that the area where the image is present is located at a center of the area of the crop box.
Information about the crop box thus found is associated with the image data as attribute information of the image data of the maximum size. When displaying or printing the document image, the crop box is cut out from the image data on the basis of the attribute information, and only the image within the crop box is displayed or printed. Accordingly, skew of the document image is corrected.